<?php
for ($a = 1; $a <= 9; $a++) {
    for ($b = 1; $b <= $a; $b++) {
        printf("%2d *%2d=%2d&nbsp;&nbsp;&nbsp;&nbsp;", $b, $a, $a * $b);
    }
    echo '<br>';
}
echo '<br>';
for ($a = 9; $a >= 1; $a--) {
    for ($b = 1; $b <= $a; $b++) {
        printf("%2d *%2d=%2d&nbsp;&nbsp;&nbsp;&nbsp;", $b, $a, $a * $b);
    }
    echo '<br>';
}